home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / m68k / cc68k.arc / SEARCHKW.C < prev    next >
C/C++ Source or Header  |  1986-10-26  |  2KB  |  55 lines

  1. #include        "stdio.h"
  2. #include        "string.h"
  3. #include        "c.h"
  4. #include        "expr.h"
  5. #include        "gen.h"
  6. #include        "cglbdec.h"
  7.  
  8.  
  9. /*
  10.  *    68000 C compiler
  11.  *
  12.  *    Copyright 1984, 1985, 1986 Matthew Brandt.
  13.  *  all commercial rights reserved.
  14.  *
  15.  *    This compiler is intended as an instructive tool for personal use. Any
  16.  *    use for profit without the written consent of the author is prohibited.
  17.  *
  18.  *    This compiler may be distributed freely for non-commercial use as long
  19.  *    as this notice stays intact. Please forward any enhancements or questions
  20.  *    to:
  21.  *
  22.  *        Matthew Brandt
  23.  *        Box 920337
  24.  *        Norcross, Ga 30092
  25.  */
  26.  
  27. struct kwblk {
  28.         char            *word;
  29.         int              stype;
  30.         }       keywords[] = {
  31.  
  32.         {"int", kw_int}, {"char", kw_char}, {"long", kw_long},
  33.         {"float", kw_float}, {"double", kw_double}, {"return", kw_return},
  34.         {"struct", kw_struct}, {"union", kw_union}, {"typedef", kw_typedef},
  35.         {"enum", kw_enum}, {"static", kw_static}, {"auto", kw_auto},
  36.         {"sizeof", kw_sizeof}, {"do", kw_do}, {"if", kw_if},
  37.         {"else", kw_else}, {"for", kw_for},{"switch", kw_switch},
  38.         {"while", kw_while},{"short", kw_short}, {"extern", kw_extern},
  39.         {"case", kw_case}, {"goto", kw_goto}, {"default", kw_default},
  40.         {"register", kw_register}, {"unsigned", kw_unsigned},
  41.         {"break", kw_break}, {"continue", kw_continue}, {"void", kw_void},
  42.         {0, 0} };
  43.  
  44. int searchkw()
  45. {       struct kwblk    *kwbp;
  46.         kwbp = keywords;
  47.         while(kwbp->word != 0) {
  48.                 if(strcmp(lastid,kwbp->word) == 0)
  49.                         return lastst = kwbp->stype;
  50.                 else
  51.                         ++kwbp;
  52.                 }
  53. }
  54.  
  55.